<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   主题：求帮助，这个数据集怎么用R进行数据的汇总统计。  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript">
   MathJax.Hub.Config({elements: ["bbpress-forums"]});
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://cos.name/cn/topic/108947/?new=1",
                  host: "http://cos.name",
                  prePath: "http://cos.name",
                  scheme: "http",
                  pathBase: "http://cos.name/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466447156: Accept with keywords: (title(0.25):汇总,主题,数据,论坛, topn(0.3):软件应用,程序,帖子,会员,数据格式,用户名,结果,主站,汇总,例子,子集,计算,数据,变量,记录,检验,密码,总计,感觉,集合,版主,主题,是不是,普通,差值,数据量,论坛,时间,思路,讨论区).-->
 </head>
 <body class="topic bbpress single single-topic postid-108947 single-author sidebar" onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    主题：求帮助，这个数据集怎么用R进行数据的汇总统计。
   </h1>
  </div>
  <div class="container" id="xmain">
   <div class="hfeed site" id="page">
    <header class="site-header" id="masthead" role="banner">
     <div id="cos-logo">
      <a href="http://cos.name/cn">
       <img src="http://cos.name/cn/wp-content/themes/COS-forest/images/headers/cos-logo.png"/>
      </a>
     </div>
     <div class="navbar" id="navbar">
      <nav class="navigation main-navigation" id="site-navigation" role="navigation">
       <h3 class="menu-toggle">
        菜单
       </h3>
       <div class="menu-%e8%8f%9c%e5%8d%951-container">
        <ul class="nav-menu" id="menu-%e8%8f%9c%e5%8d%951">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-407772" id="menu-item-407772">
          <a href="http://cos.name/cn/">
           论坛首页
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407773" id="menu-item-407773">
          <a href="http://cos.name/cn/forums/">
           讨论区
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407774" id="menu-item-407774">
          <a href="http://cos.name/cn/wp-login.php?action=register">
           注册
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-407819" id="menu-item-407819">
          <a href="http://cos.name/">
           主站
          </a>
         </li>
        </ul>
       </div>
      </nav>
      <!-- #site-navigation -->
     </div>
     <!-- #navbar -->
    </header>
    <!-- #masthead -->
    <div class="site-main" id="main">
     <div class="content-area" id="primary">
      <div class="site-content" id="content" role="main">
       <article class="post-108947 topic type-topic status-publish hentry" id="post-108947">
        <header class="entry-header">
         <h1 class="entry-title">
          求帮助，这个数据集怎么用R进行数据的汇总统计。
         </h1>
        </header>
        <!-- .entry-header -->
        <div class="entry-content">
         <div id="bbpress-forums">
          <div class="bbp-breadcrumb">
           <p>
            <a class="bbp-breadcrumb-home" href="http://cos.name/cn/">
             COS论坛 | 统计之都
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-root" href="http://cos.name/cn/forums/">
             讨论区
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/">
             软件应用
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <a class="bbp-breadcrumb-forum" href="http://cos.name/cn/forum/software/r-language/">
             S-Plus &amp; R语言
            </a>
            <span class="bbp-breadcrumb-sep">
             ›
            </span>
            <span class="bbp-breadcrumb-current">
             求帮助，这个数据集怎么用R进行数据的汇总统计。
            </span>
           </p>
          </div>
          <div class="bbp-template-notice info">
           <p class="bbp-topic-description">
            该主题包含 15 条回复，5个帖子，最后由
            <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
             <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=14&amp;d=monsterid&amp;r=g"/>
            </a>
            <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
             sikisis
            </a>
            在
            <a href="http://cos.name/cn/topic/108947/page/2/#post-341088" title="回复：求帮助，这个数据集怎么用R进行数据的汇总统计。">
             3 年, 5 月 之前
            </a>
            更新。
           </p>
          </div>
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 15 个帖子 - 1 到 15（总计 16 个）
           </div>
           <div class="bbp-pagination-links">
            <span class="page-numbers current">
             1
            </span>
            <a class="page-numbers" href="http://cos.name/cn/topic/108947/page/2/?new=1">
             2
            </a>
            <a class="next page-numbers" href="http://cos.name/cn/topic/108947/page/2/?new=1">
             →
            </a>
           </div>
          </div>
          <ul class="forums bbp-replies" id="topic-108947-replies">
           <li class="bbp-header">
            <div class="bbp-reply-author">
             作者
            </div>
            <!-- .bbp-reply-author -->
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-header -->
           <li class="bbp-body">
            <div class="bbp-reply-header" id="post-108947">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月19日 上午9:57
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-108947">
               1 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-108947 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-1 user-id-378289 topic-author post-108947 topic type-topic status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               数据集如下：
               <br/>
               SKUCode	        Time	 DailySales
               <br/>
               C021680205	2012/1/1	6
               <br/>
               C021680204	2012/1/1	6
               <br/>
               C021800200	2012/1/1	6
               <br/>
               C024451100	2012/1/1	3
               <br/>
               C024461005	2012/1/1	3
               <br/>
               C024800405	2012/1/1	3
              </p>
              <p>
               SKU代表不同商品。分别记录了很多天比如60天吧（不一定每天都要有交易）的销售数目。
               <br/>
               现在我为了统计比如前10天内”C021680205″商品销售总数量，该怎么办？
              </p>
              <p>
               我的想法是先比如找出所有”C021680205″商品的所有记录，然后一个个的看，是不是和第一次出现的销售记录日期比对，如果在10天内就计入总数，不再就忽略。
               <br/>
               但是这个算法似乎，在R里面不是很好实现。
               <br/>
               首先是时间的差值，总是有“the time difference is”这个字符串。
               <br/>
               然后就是这个貌似要用到循环，感觉特别繁琐。
              </p>
              <p>
               求问有没有什么很好的思路的？
               <br/>
               谢谢！
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340866">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月19日 上午10:04
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340866">
               2 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340866 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-2 user-id-336 post-340866 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/336/" rel="nofollow" title="查看刘思喆的档案">
               <img src="http://sdn.geekzu.org/avatar/6ca0529d22d1bf25a1e5cee3af3456f9?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/336/" rel="nofollow" title="查看刘思喆的档案">
               刘思喆
              </a>
              <br/>
              <div class="bbp-author-role">
               版主
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               最好丢到MySQL里做
               <br/>
               当然纯用R也是能做的，思路大概有3种吧，稍稍有些麻烦，但速度很快，其中的一种：
               <br/>
               参考seq(), %in%
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340894">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 上午12:49
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340894">
               3 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340894 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-3 user-id-366541 post-340894 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/366541/" rel="nofollow" title="查看abbo的档案">
               <img src="http://sdn.geekzu.org/avatar/bb0169c7a5a86765041acd1609213ecd?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/366541/" rel="nofollow" title="查看abbo的档案">
               abbo
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第2楼 的 刘思喆：看来俺下次得考虑弄R擅长的放到R里…= =！[s:14]
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340896">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 上午2:06
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340896">
               4 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340896 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-4 user-id-89926 post-340896 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/89926/" rel="nofollow" title="查看bioshaw的档案">
               <img src="http://sdn.geekzu.org/avatar/be4ee5ecd3f2670e22697b7b451b43df?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/89926/" rel="nofollow" title="查看bioshaw的档案">
               bioshaw
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               ddply应该可以很方便的处理。效率取决于数据量和SKUCode 的水平数。
               <br/>
               据说data.table也有它的优势。
              </p>
              <pre class="highlight ">library(plyr)
df$Time &lt;- as.Date(df$Time)
ddply(df, .(SKUCode), subset,  Time &lt;= min(Time)+10)
</pre>
              <p>
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340911">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 下午12:39
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340911">
               5 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340911 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-5 user-id-378289 topic-author post-340911 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第4楼 的 bioshaw：谢谢，这样做的话，我可以做了但是还是感觉有点不对。
               <br/>
               我写的程序如下：
               <br/>
               ddply(dailysale, .(firstsale[,1]), subset,  Time &lt;= min(Time)+10)
              </p>
              <p>
               其中.(firstsale[,1])就是我需要的SKUcode的集合，但是subset是什么？
               <br/>
               我查了帮助，subset似乎是从某个矩阵中找出满足条件的项的函数，但是这个和我的需求似乎不是很贴切啊。
               <br/>
               求问该怎么用下去。
              </p>
              <p>
               谢谢！
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340913">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 下午12:46
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340913">
               6 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340913 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-6 user-id-378289 topic-author post-340913 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第4楼 的 bioshaw：我做出来的结果是这样的。
               <br/>
               firstsale[, 1]	X.SKUCode	Time	DailySales
               <br/>
               1	 	H076259900	2012-01-06	3
               <br/>
               2	 	H080819900	2012-01-06	27
               <br/>
               3	 	H080819900	2012-01-06	21
               <br/>
               4	 	H092410000	2012-01-06	3
               <br/>
               5	 	H092410000	2012-01-06	3
               <br/>
               6	 	H094389900	2012-01-06	3
              </p>
              <p>
               感觉怎么把数据的和增加一列表示出来呢？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340915">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 下午2:28
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340915">
               7 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340915 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-7 user-id-378289 topic-author post-340915 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第4楼 的 bioshaw：
               <br/>
               比如说我用这个程序计算了一下。
               <br/>
               library(plyr)
               <br/>
               dailysale$Time &lt;- as.Date(dailysale$Time)
               <br/>
               temp&lt;-ddply(dailysale,.(firstsale[,1]), subset,Time &lt;= min(Time)+10)
               <br/>
               输出的结果是这样的:
               <br/>
               firstsale[, 1]	X.SKUCode	Time	DailySales
               <br/>
               1	 	H076259900	2012-01-06	3
               <br/>
               2	 	H080819900	2012-01-06	27
               <br/>
               3	 	H080819900	2012-01-06	21
               <br/>
               4	 	H092410000	2012-01-06	3
               <br/>
               5	 	H092410000	2012-01-06	3
               <br/>
               6	 	H094389900	2012-01-06	3
               <br/>
               7	 	H094409900	2012-01-06	3
               <br/>
               然后我随便找了一个SKU检验了一下：
               <br/>
               which(temp[,2]==”H076259900″)
               <br/>
               firstsale[, 1]  X.SKUCode   Time                DailySales
               <br/>
               1                   H076259900 2012-01-06          3
               <br/>
               2387                H076259900 2012-01-11          6
               <br/>
               3680                H076259900 2012-01-16          6
               <br/>
               6908   LC10727X0005 H076259900 2012-01-05          9
               <br/>
               我一直奇怪为什么firstsale[, 1]有的出现了值有的没有出现了。
               <br/>
               同时2012-01-16比2012-01-05   大了11天。
               <br/>
               firstsale的数据格式是这样的：
               <br/>
               X.SKU	         上架	          下架	        在线销售时间.时.	期间销量
               <br/>
               1	C010100100	2012/2/13	2012/4/19 17:00	66.7083333	238
               <br/>
               2	C010930200	2012/5/3	2012/7/29 0:00	87.0000000	3
               <br/>
               3	C011361100	2012/2/13	2012/5/25 22:29	102.5000000	110
               <br/>
               4	C012000204	2012/8/13	2012/11/12 11:00	91.4583333	245
               <br/>
               5	C012000205	2012/8/13	2012/11/12 0:00	91.0000000	331
               <br/>
               6	C012791100	2012/2/27	2012/5/23 21:33	86.4583333	41
               <br/>
               求指导。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340918">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 下午3:15
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340918">
               8 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340918 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-8 user-id-378289 topic-author post-340918 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               我又试了几个SKU对应的数据集。
               <br/>
               是不是需要减去1呢？
               <br/>
               毕竟这个在计算的时候其实12-01，12-02这是两天但是算差值就是1天.
               <br/>
               我改成了time&lt;time+9就对了。
               <br/>
               原因该是这样吧？
              </p>
              <p>
               就是还是想知道subset这个参数是在作什么？help里面没写。
               <br/>
               谢谢3Q！
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340923">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 下午4:12
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340923">
               9 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340923 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-9 user-id-378289 topic-author post-340923 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第2楼 的 刘思喆：大神还是没有发现怎么用seq()，求更深入。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340924">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 下午4:13
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340924">
               10 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340924 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-10 user-id-378289 topic-author post-340924 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第4楼 的 bioshaw：我仔细看了一下，这样其实求出来得就是所有的符合的数据的集合，没有作合并但是做了数据的筛选，筛选除了我需要的数据。
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340925">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 下午4:15
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340925">
               11 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340925 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-11 user-id-378289 topic-author post-340925 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第4楼 的 bioshaw：就是下面还是需要合并，数据的，虽然过了第一个难关，是不是用ddply的例子里面给的方法。那个例子解释了对于不同的性别和group分别统计一个量的。用summarize？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340927">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月20日 下午4:35
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340927">
               12 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340927 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-12 user-id-378289 topic-author post-340927 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第4楼 的 bioshaw：还是有点问题。
               <br/>
               我是这么做的。
               <br/>
               pp&lt;-ddply(dailysale, .(firstsale[,1]), subset,Time &lt;= min(Time)+9)
               <br/>
               结果如下：
               <br/>
               pp[1:10,]
               <br/>
               firstsale[, 1]  X.SKUCode       Time DailySales
               <br/>
               1                 H076259900 2012-01-06          3
               <br/>
               2                 H080819900 2012-01-06         27
               <br/>
               3                 H080819900 2012-01-06         21
               <br/>
               4                 H092410000 2012-01-06          3
               <br/>
               5                 H092410000 2012-01-06          3
               <br/>
               6                 H094389900 2012-01-06          3
               <br/>
               7                 H094409900 2012-01-06          3
               <br/>
               8                 H094571700 2012-01-06         42
               <br/>
               9                 H094571700 2012-01-06         24
               <br/>
               10                H094939900 2012-01-06          3
              </p>
              <p>
               我如果去第二行的SKU=H080819900 进行检验的话，结果如下：
               <br/>
               pp[which(pp[,2]==”H080819900″),]
               <br/>
               firstsale[, 1]      	X.SKUCode       Time 			DailySales
               <br/>
               2                   			H080819900 2012-01-06         27
               <br/>
               3                  			H080819900 2012-01-06         21
               <br/>
               510                 		H080819900 2012-01-07         12
               <br/>
               511               			H080819900 2012-01-07         18
               <br/>
               941                		        H080819900 2012-01-08         45
               <br/>
               1409				H080819900 2012-01-09         12
               <br/>
               1903               		 H080819900 2012-01-10          3
               <br/>
               3350                               H080819900 2012-01-13          3
               <br/>
               3528     B056319900 H080819900 2012-01-04         87
               <br/>
               3529     B056370200 H080819900 2012-01-04          6
               <br/>
               4136     C047090000 H080819900 2012-01-01         15
               <br/>
               4549     C069509900 H080819900 2012-01-02         15
               <br/>
               4994     C088780005 H080819900 2012-01-03         27
               <br/>
               6583   LC10728C0003 H080819900 2012-01-05        155
               <br/>
               6584   LC10728C0004 H080819900 2012-01-05          3
              </p>
              <p>
               但是我的原始数据集合里面的关于SKU=H080819900 的结果如下：
               <br/>
               dailysale[which(dailysale[,1]==”H080819900″),]
               <br/>
               X.SKUCode       Time DailySales
               <br/>
               328    H080819900 2012-01-01         15
               <br/>
               717    H080819900 2012-01-02         15
               <br/>
               1142   H080819900 2012-01-03         27
               <br/>
               2082   H080819900 2012-01-04         87
               <br/>
               2083   H080819900 2012-01-04          6
               <br/>
               3176   H080819900 2012-01-05        155
               <br/>
               3177   H080819900 2012-01-05          3
               <br/>
               3863   H080819900 2012-01-06         27
               <br/>
               3864   H080819900 2012-01-06         21
               <br/>
               4371   H080819900 2012-01-07         12
               <br/>
               4372   H080819900 2012-01-07         18
               <br/>
               4802   H080819900 2012-01-08         45
               <br/>
               5270   H080819900 2012-01-09         12
               <br/>
               5764   H080819900 2012-01-10          3
               <br/>
               7211   H080819900 2012-01-13          3
               <br/>
               7542   H080819900 2012-01-16          6
               <br/>
               10193  H080819900 2012-02-03          9
               <br/>
               10562  H080819900 2012-02-04         12
               <br/>
               10830  H080819900 2012-02-05          6
               <br/>
               11533  H080819900 2012-02-06          9
               <br/>
               12144  H080819900 2012-02-07         15
               <br/>
               12789  H080819900 2012-02-08         27
               <br/>
               13433  H080819900 2012-02-09         33
               <br/>
               14057  H080819900 2012-02-10         18
               <br/>
               14553  H080819900 2012-02-11         12
               <br/>
               14903  H080819900 2012-02-12         12
               <br/>
               15815  H080819900 2012-02-13         18
               <br/>
               16707  H080819900 2012-02-14         24
               <br/>
               17572  H080819900 2012-02-15          6
               <br/>
               19166  H080819900 2012-02-17          6
               <br/>
               22871  H080819900 2012-02-22          3
               <br/>
               192769 H080819900 2012-09-03          6
               <br/>
               194275 H080819900 2012-09-04          3
               <br/>
               195791 H080819900 2012-09-06          3
               <br/>
               199117 H080819900 2012-09-10        221
               <br/>
               199638 H080819900 2012-09-10         42
               <br/>
               200156 H080819900 2012-09-11        117
               <br/>
               200614 H080819900 2012-09-11          6
               <br/>
               201103 H080819900 2012-09-12        117
               <br/>
               201541 H080819900 2012-09-12         18
               <br/>
               202061 H080819900 2012-09-13         30
               <br/>
               202062 H080819900 2012-09-13         60
               <br/>
               202504 H080819900 2012-09-13          3
               <br/>
               202505 H080819900 2012-09-13         18
               <br/>
               202952 H080819900 2012-09-14          3
               <br/>
               202953 H080819900 2012-09-14         99
               <br/>
               203364 H080819900 2012-09-14          3
               <br/>
               203365 H080819900 2012-09-14         27
               <br/>
               203776 H080819900 2012-09-15         63
               <br/>
               204234 H080819900 2012-09-16         39
               <br/>
               204582 H080819900 2012-09-15         18
               <br/>
               204866 H080819900 2012-09-16         27
               <br/>
               205565 H080819900 2012-09-17         72
               <br/>
               206196 H080819900 2012-09-17          6
               <br/>
               206811 H080819900 2012-09-18         69
               <br/>
               207370 H080819900 2012-09-18         21
               <br/>
               207939 H080819900 2012-09-19         45
               <br/>
               208441 H080819900 2012-09-19         27
               <br/>
               208973 H080819900 2012-09-20         60
               <br/>
               209465 H080819900 2012-09-20         42
               <br/>
               209948 H080819900 2012-09-21         36
               <br/>
               210377 H080819900 2012-09-21         12
               <br/>
               210810 H080819900 2012-09-22         27
               <br/>
               211264 H080819900 2012-09-23         36
               <br/>
               211598 H080819900 2012-09-22          9
               <br/>
               211863 H080819900 2012-09-23          6
               <br/>
               212375 H080819900 2012-09-24         21
               <br/>
               213047 H080819900 2012-09-24         15
               <br/>
               213975 H080819900 2012-09-25         99
               <br/>
               214786 H080819900 2012-09-25         27
               <br/>
               215537 H080819900 2012-09-26         66
               <br/>
               215538 H080819900 2012-09-26          3
               <br/>
               216222 H080819900 2012-09-26          6
               <br/>
               216809 H080819900 2012-09-27          9
               <br/>
               216810 H080819900 2012-09-27         27
               <br/>
               217347 H080819900 2012-09-27          9
               <br/>
               217838 H080819900 2012-09-28         18
               <br/>
               217839 H080819900 2012-09-28         15
               <br/>
               218260 H080819900 2012-09-28        122
               <br/>
               218671 H080819900 2012-09-29         18
               <br/>
               219054 H080819900 2012-09-30         27
               <br/>
               219419 H080819900 2012-10-01         21
               <br/>
               219777 H080819900 2012-10-02         12
               <br/>
               220155 H080819900 2012-10-03         21
               <br/>
               220501 H080819900 2012-10-04         21
               <br/>
               220914 H080819900 2012-10-05         36
               <br/>
               221248 H080819900 2012-09-29         75
               <br/>
               221495 H080819900 2012-09-30         42
               <br/>
               221731 H080819900 2012-10-01          6
               <br/>
               222210 H080819900 2012-10-03          3
               <br/>
               222483 H080819900 2012-10-04          6
               <br/>
               222735 H080819900 2012-10-05          6
               <br/>
               223089 H080819900 2012-10-06         27
               <br/>
               223455 H080819900 2012-10-06          9
               <br/>
               223798 H080819900 2012-10-07         33
               <br/>
               224157 H080819900 2012-10-07          6
               <br/>
               224158 H080819900 2012-10-07          3
               <br/>
               224687 H080819900 2012-10-08         45
               <br/>
               225336 H080819900 2012-10-08         15
               <br/>
               225937 H080819900 2012-10-09         63
               <br/>
               226505 H080819900 2012-10-09         15
               <br/>
               227080 H080819900 2012-10-10         39
               <br/>
               227657 H080819900 2012-10-10         12
               <br/>
               228194 H080819900 2012-10-11         42
               <br/>
               228725 H080819900 2012-10-11         30
               <br/>
               229246 H080819900 2012-10-12          9
               <br/>
               229247 H080819900 2012-10-12         21
               <br/>
               229742 H080819900 2012-10-12         18
               <br/>
               230186 H080819900 2012-10-13         21
               <br/>
               230722 H080819900 2012-10-14         21
               <br/>
               230723 H080819900 2012-10-14          3
               <br/>
               231106 H080819900 2012-10-13         12
               <br/>
               231414 H080819900 2012-10-14          3
               <br/>
               231949 H080819900 2012-10-15         27
               <br/>
               232552 H080819900 2012-10-15         18
               <br/>
               233111 H080819900 2012-10-16         33
               <br/>
               233658 H080819900 2012-10-16         12
               <br/>
               234294 H080819900 2012-10-17         48
               <br/>
               234776 H080819900 2012-10-17          3
               <br/>
               235301 H080819900 2012-10-18         39
               <br/>
               235788 H080819900 2012-10-18         21
               <br/>
               236279 H080819900 2012-10-19         33
               <br/>
               236695 H080819900 2012-10-19         12
               <br/>
               237087 H080819900 2012-10-20         21
               <br/>
               237541 H080819900 2012-10-21         21
               <br/>
               237897 H080819900 2012-10-20          3
               <br/>
               237898 H080819900 2012-10-20         24
               <br/>
               238626 H080819900 2012-10-22         33
               <br/>
               239094 H080819900 2012-10-22          3
               <br/>
               239591 H080819900 2012-10-23         33
               <br/>
               240053 H080819900 2012-10-23          6
               <br/>
               240506 H080819900 2012-10-24         15
               <br/>
               240992 H080819900 2012-10-24         15
               <br/>
               241450 H080819900 2012-10-25         18
               <br/>
               241909 H080819900 2012-10-25          9
               <br/>
               241910 H080819900 2012-10-25          3
               <br/>
               242334 H080819900 2012-10-26         33
               <br/>
               242778 H080819900 2012-10-26         27
               <br/>
               243184 H080819900 2012-10-27         27
               <br/>
               243671 H080819900 2012-10-28         21
               <br/>
               244010 H080819900 2012-10-27          9
               <br/>
               244257 H080819900 2012-10-28          9
               <br/>
               244678 H080819900 2012-10-29         24
               <br/>
               245131 H080819900 2012-10-29          6
               <br/>
               245620 H080819900 2012-10-30         24
               <br/>
               246102 H080819900 2012-10-30          3
               <br/>
               246544 H080819900 2012-10-31         21
               <br/>
               246986 H080819900 2012-10-31          3
               <br/>
               247410 H080819900 2012-11-01         24
               <br/>
               247816 H080819900 2012-11-01          9
               <br/>
               248202 H080819900 2012-11-02         18
               <br/>
               248622 H080819900 2012-11-03         36
               <br/>
               248998 H080819900 2012-11-04         12
               <br/>
               249568 H080819900 2012-11-03          3
               <br/>
               250184 H080819900 2012-11-05         33
               <br/>
               250618 H080819900 2012-11-05         12
               <br/>
               250970 H080819900 2012-11-06         18
               <br/>
               251323 H080819900 2012-11-06         15
               <br/>
               251694 H080819900 2012-11-07         18
               <br/>
               252075 H080819900 2012-11-07          3
               <br/>
               252425 H080819900 2012-11-08         15
               <br/>
               252750 H080819900 2012-11-08          6
               <br/>
               253046 H080819900 2012-11-09         12
               <br/>
               253328 H080819900 2012-11-09          6
               <br/>
               253591 H080819900 2012-11-10         12
               <br/>
               254685 H080819900 2012-11-11        167
               <br/>
               256539 H080819900 2012-11-13         15
               <br/>
               257310 H080819900 2012-11-12         30
               <br/>
               258070 H080819900 2012-11-13         18
               <br/>
               258669 H080819900 2012-11-14         12
               <br/>
               259147 H080819900 2012-11-12          3
               <br/>
               260229 H080819900 2012-11-13          6
               <br/>
               261364 H080819900 2012-11-15         18
               <br/>
               262291 H080819900 2012-11-16         18
               <br/>
               262745 H080819900 2012-11-17         12
               <br/>
               263164 H080819900 2012-11-18          6
               <br/>
               263564 H080819900 2012-11-16          3
               <br/>
               263962 H080819900 2012-11-17          3
               <br/>
               264784 H080819900 2012-11-19         18
               <br/>
               265274 H080819900 2012-11-19          6
               <br/>
               265764 H080819900 2012-11-20         18
               <br/>
               266242 H080819900 2012-11-20          3
               <br/>
               266714 H080819900 2012-11-21          9
               <br/>
               267198 H080819900 2012-11-21          9
               <br/>
               267680 H080819900 2012-11-22          9
               <br/>
               268141 H080819900 2012-11-22          3
               <br/>
               268567 H080819900 2012-11-24         18
               <br/>
               269037 H080819900 2012-11-25          9
               <br/>
               270206 H080819900 2012-11-23         18
               <br/>
               271160 H080819900 2012-11-26         12
               <br/>
               271757 H080819900 2012-11-26          3
               <br/>
               272225 H080819900 2012-11-27         18
               <br/>
               273206 H080819900 2012-11-28         15
               <br/>
               273795 H080819900 2012-11-28          6
               <br/>
               274362 H080819900 2012-11-29          6
               <br/>
               274912 H080819900 2012-11-29         12
               <br/>
               275414 H080819900 2012-11-30          9
               <br/>
               276295 H080819900 2012-12-01         12
               <br/>
               276738 H080819900 2012-12-02          9
               <br/>
               277137 H080819900 2012-12-01          3
               <br/>
               277862 H080819900 2012-12-03          9
               <br/>
               278768 H080819900 2012-12-04          6
               <br/>
               279176 H080819900 2012-12-04          9
               <br/>
               279547 H080819900 2012-12-05          9
               <br/>
               280181 H080819900 2012-12-05          6
               <br/>
               280815 H080819900 2012-12-06         24
               <br/>
               281288 H080819900 2012-12-06          3
               <br/>
               282208 H080819900 2012-12-07          6
               <br/>
               282620 H080819900 2012-12-08          9
               <br/>
               283021 H080819900 2012-12-09          6
              </p>
              <p>
               可以看到最小的出现销售记录的日期是 2012-01-01  和我记录结果的pp变量中的结果完全不符合。
               <br/>
               sigh！
               <br/>
               求问哪里出了问题。
               <br/>
               谢谢！
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340937">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月21日 上午2:37
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340937">
               13 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340937 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-13 user-id-89926 post-340937 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/89926/" rel="nofollow" title="查看bioshaw的档案">
               <img src="http://sdn.geekzu.org/avatar/be4ee5ecd3f2670e22697b7b451b43df?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/89926/" rel="nofollow" title="查看bioshaw的档案">
               bioshaw
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
              </p>
              <pre class="highlight ">library(plyr)
dailysale$Time &lt;- as.Date(dailysale$Time)
temp&lt;-ddply(dailysale,.(SKUCode), subset,Time &lt;= min(Time)+10)
## 以上只是得到数据子集,其实有了这个子集后，后面应该方便了。。。
##.variables  variables to split data frame by, as quoted variables, a formula or character vector
res &lt;- ddply(temp, .(SKUCode), summarise,  total=sum(DailySales))
#这才是你说的前10天的销售总量
</pre>
              <p>
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340938">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月21日 上午3:08
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340938">
               14 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340938 -->
            <div class="even bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-14 user-id-369487 post-340938 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/369487/" rel="nofollow" title="查看ruikoeln的档案">
               <img src="http://sdn.geekzu.org/avatar/8bce8a6da031c2577ea480057979cb05?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/369487/" rel="nofollow" title="查看ruikoeln的档案">
               ruikoeln
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第13楼 的 bioshaw：very nice, 时间本来是文字变量，又又做数值计算的需要。这个包还是不错的[s:11]
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
            <div class="bbp-reply-header" id="post-340999">
             <div class="bbp-meta">
              <span class="bbp-reply-post-date">
               2012年12月24日 上午4:24
              </span>
              <a class="bbp-reply-permalink" href="http://cos.name/cn/topic/108947/#post-340999">
               15 楼
              </a>
              <span class="bbp-admin-links">
              </span>
             </div>
             <!-- .bbp-meta -->
            </div>
            <!-- #post-340999 -->
            <div class="odd bbp-parent-forum-999 bbp-parent-topic-108947 bbp-reply-position-15 user-id-378289 topic-author post-340999 reply type-reply status-publish hentry">
             <div class="bbp-reply-author">
              <a class="bbp-author-avatar" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               <img src="http://sdn.geekzu.org/avatar/5f8fb31ab45da1e2c66d534153967168?s=80&amp;d=monsterid&amp;r=g"/>
              </a>
              <br/>
              <a class="bbp-author-name" href="http://cos.name/cn/profile/378289/" rel="nofollow" title="查看sikisis的档案">
               sikisis
              </a>
              <br/>
              <div class="bbp-author-role">
               普通会员
              </div>
             </div>
             <!-- .bbp-reply-author -->
             <div class="bbp-reply-content">
              <p>
               回复 第13楼 的 bioshaw：ding!
               <br/>
               谢谢啦。
               <br/>
               一直想问temp&lt;-ddply(dailysale,.(SKUCode), subset,Time &lt;= min(Time)+10)
               <br/>
               其中的“subset”是什么意思？
              </p>
              <p>
               和下面res &lt;- ddply(temp, .(SKUCode), summarise,  total=sum(DailySales))对比来看
               <br/>
               似乎和“summarise”一样，表示一种统计方法？
              </p>
              <p>
               subset难道是抽取子集的意思？
              </p>
             </div>
             <!-- .bbp-reply-content -->
            </div>
            <!-- .reply -->
           </li>
           <!-- .bbp-body -->
           <li class="bbp-footer">
            <div class="bbp-reply-author">
             作者
            </div>
            <div class="bbp-reply-content">
             帖子
            </div>
            <!-- .bbp-reply-content -->
           </li>
           <!-- .bbp-footer -->
          </ul>
          <!-- #topic-108947-replies -->
          <div class="bbp-pagination">
           <div class="bbp-pagination-count">
            查看 15 个帖子 - 1 到 15（总计 16 个）
           </div>
           <div class="bbp-pagination-links">
            <span class="page-numbers current">
             1
            </span>
            <a class="page-numbers" href="http://cos.name/cn/topic/108947/page/2/?new=1">
             2
            </a>
            <a class="next page-numbers" href="http://cos.name/cn/topic/108947/page/2/?new=1">
             →
            </a>
           </div>
          </div>
          <div class="bbp-no-reply" id="no-reply-108947">
           <div class="bbp-template-notice">
            <p>
             您必须先登录才能回复该主题。
            </p>
           </div>
          </div>
         </div>
        </div>
        <!-- .entry-content -->
        <footer class="entry-meta">
        </footer>
        <!-- .entry-meta -->
       </article>
       <!-- #post -->
       <div class="comments-area" id="comments">
       </div>
       <!-- #comments -->
      </div>
      <!-- #content -->
     </div>
     <!-- #primary -->
     <div class="sidebar-container" id="tertiary" role="complementary">
      <div class="sidebar-inner">
       <div class="widget-area">
        <aside class="widget bbp_widget_login" id="bbp_login_widget-2">
         <h3 class="widget-title">
          登录
         </h3>
         <form action="http://cos.name/cn/wp-login.php" class="bbp-login-form" method="post">
          <fieldset>
           <legend>
            登录
           </legend>
           <div class="bbp-username">
            <label for="user_login">
             用户名:
            </label>
           </div>
           <div class="bbp-password">
            <label for="user_pass">
             密码:
            </label>
           </div>
           <div class="bbp-remember-me">
            <label for="rememberme">
             记住用户名
            </label>
           </div>
           <div class="bbp-submit-wrapper">
            <button class="button submit user-submit" id="user-submit" name="user-submit" tabindex="104" type="submit">
             登录
            </button>
           </div>
           <div class="bbp-login-links">
            <a class="bbp-register-link" href="http://cos.name/cn/wp-login.php?action=register" title="注册">
             注册
            </a>
            <a class="bbp-lostpass-link" href="http://cos.name/cn/wp-login.php?action=lostpassword" title="忘记密码">
             忘记密码
            </a>
           </div>
          </fieldset>
         </form>
        </aside>
        <aside class="widget widget_text" id="text-7">
         <h3 class="widget-title">
          搜索
         </h3>
         <div class="textwidget">
          <form action="http://www.google.com/search" id="bbp-search-form" method="get" onsubmit="Gsitesearch(this)" role="search">
           <div>
           </div>
          </form>
          <form id="bbp-search-form-baidu" onsubmit="g(this)" role="search">
           <div>
           </div>
          </form>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-2">
         <h3 class="widget-title">
          新鲜事
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <a href="http://cos.name/cn/topics/">
             最新帖子
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/popular/">
             最热门主题
            </a>
           </li>
           <li>
            <a href="http://cos.name/cn/view/no-replies/">
             消灭零回复
            </a>
           </li>
          </ul>
         </div>
        </aside>
        <aside class="widget widget_text" id="text-3">
         <h3 class="widget-title">
          RSS订阅
         </h3>
         <div class="textwidget">
          <ul>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/topics/feed/">
             所有主题
            </a>
           </li>
           <li>
            <img src="http://cos.name/wp-includes/images/rss.png"/>
            <a href="http://cos.name/cn/forums/feed/">
             所有帖子
            </a>
           </li>
          </ul>
         </div>
        </aside>
       </div>
       <!-- .widget-area -->
      </div>
      <!-- .sidebar-inner -->
     </div>
     <!-- #tertiary -->
    </div>
    <!-- #main -->
    <footer class="site-footer" id="colophon" role="contentinfo">
     <div class="site-info">
      版权所有 © 2014 统计之都 | 由
      <a href="http://wordpress.org/">
       WordPress
      </a>
      构建 | 主题修改自
      <a href="http://wordpress.org/themes/twentythirteen">
       Twenty Thirteen
      </a>
     </div>
     <!-- .site-info -->
    </footer>
    <!-- #colophon -->
   </div>
   <!-- #page -->
  </div>
 </body>
</html>